<?php
	$pictures = [
		'1.png',
		'2.png',
		'3.png',
		'4.png',
		'5.png',
		'6.png',
		'7.png',
		'8.png',
		'9.png',
		'10.png'
	];

	$colors = [
		'#1abc9c',
		'#2ecc71',
		'#3498db',
		'#9b59b6',
		'#34495e',
		'#16a085',
		'#27ae60',
		'#2980b9',
		'#8e44ad',
		'#d35400'
	];

	//shuffle()函数,随机打乱数组
	// shuffle($pictures);
	// shuffle($colors);

	$rand_color = array_rand($colors,1);

	$rand_picture = array_rand($pictures,3);

?>
<!DOCTYPE html>
<html>
<head>
	<title>shuffle函数,随机打乱数组</title>
</head>
<body bgcolor=<?php
	echo $colors[$rand_color];
?>>
	<center>
		<h1>Bob的产品数据</h1>
		<table width="100%">
			<tr>
				<?php
					// for($i = 0 ; $i < 3 ; $i++){
					// 	echo '<td align="center"><img src="';
					// 		echo "../image/".$pictures[$i];
					// 	echo '" width="300" height="200"></td>';
					// }
				foreach ($rand_picture as $value) {
						echo '<td align="center"><img src="';
							echo "../image/".$pictures[$value];
						echo '" width="300" height="200"></td>';
				}
				?>
			</tr>
		</table>
	</center>
</body>
</html>